*********************************************************************************																		       ** 							VAP								 				   **								     									       ********************************************************************************** -----> This do-file: All tables and graphs using main Twitter data********************************************************************************set more offclear allset matsize 3000set maxvar 10000************************************* Path if "`c(username)'"=="Juan S. Morales" | "`c(username)'"=="jmorales"{	global PathData = "C:/Users/`c(username)'/Dropbox/adamowicz/4_Draft/CPS_FINAL_submission/Data/"	global PathFig = "C:/Users/`c(username)'/Dropbox/adamowicz/4_Draft/CPS_FINAL_submission/Figures/"	global PathTab = "C:/Users/`c(username)'/Dropbox/adamowicz/4_Draft/CPS_FINAL_submission/Tables/"	}else { 	global PathData = "/Users/JNG/Dropbox/adamowicz/4_Draft/CPS_FINAL_submission/Data/"	global PathFig = "/Users/JNG/Dropbox/adamowicz/4_Draft/CPS_FINAL_submission/Figures/"	global PathTab = "/Users/JNG/Dropbox/adamowicz/4_Draft/CPS_FINAL_submission/Tables/"	} use "${PathData}tweets_poland.dta", clear***Basic data cleaning and generate basic controls****sort screen_namemerge screen_name using "${PathData}mayors.dta"drop if mayor==1drop mayordrop _mergegen date = substr(created_at,1,10)gen month = substr(date,6,2)gen year = substr(date,1,4)gen day = substr(date,9,2)gen hour = substr(created_at,12,2)destring(month), replacedestring(year), replacedestring(day), replacedestring(hour), replacegen time = (year-2012)*12 + monthgen timeD = (year-2012)*365 + (month==2)*31 + (month==3)*(31+28) + (month==4)*(31*2 + 28) + (month==5)*(31*2 + 28 +30) + (month==6)*(31*3 + 28 +30) + (month==7)*(31*3 + 28 + 30*2) + (month==8)*(31*4 + 28 + 30*2) + (month==9)*(31*5 + 28 + 30*2) + (month==10)*(31*5 + 28 + 30*3) + (month==11)*(31*6 + 28 + 30*3) + (month==12)*(31*6 + 28 + 30*4) + day + 1*((month>2 & year==2012)|(year>2012))gen week = round(timeD/7)gen date2 = mdy(month, day, year)gen text_l = lower(text)replace text = text_ldrop text_lreplace text = subinstr(text, "á", "a",.) replace text = subinstr(text, "é", "e",.) replace text = subinstr(text, "í", "i",.) replace text = subinstr(text, "ó", "o",.) replace text = subinstr(text, "ú", "u",.)replace text = subinstr(text, "ñ", "nh",.)replace text = subinstr(text, ",", " ",.)replace text = subinstr(text, `"""',  "", .)replace text = subinstr(text, ".", " ",.) replace text = subinstr(text, "-", " ",.)replace text = subinstr(text, "!", " ",.) replace text = subinstr(text, "/", " ",.)replace text = subinstr(text, "…", " ",.)replace text = subinstr(text, ":", " ",.)replace text = subinstr(text, ";", " ",.)* replace text = subinstr(text, "#", "",.)* replace text = subinstr(text, "@", "",.)forvalues i = 1(1)7 {	replace text = subinstr(text, "  ", " ",.)}capture drop gg_*gen gg_hashtag = strpos(text, "#")>0gen gg_at = strpos(text, "@")>0gen gg_reply = in_reply_to_user!=""*at zero for this datasetgen gg_rt = strpos(text, "rt ") == 1gen gg_http = strpos(text, "http")>0***merge MP data****merge m:m screen_name using "${PathData}mp.dta"rename _merge mergeMP***** Coding VARIABLES (general) *****gen dOfWeek = mod(date2,7)replace dOfWeek = dOfWeek - 2replace dOfWeek = dOfWeek + 7 if dOfWeek<1drop gg_rtgen gg_rt = strpos(text, "rt ") == 1gen gg_adamowicz = strpos(text, "adamowicz")>0gen log_rt = log(rt_count + 1)gen log_fav = log(favcount + 1)gen log_engagement = log(rt_count + favcount + 1)egen userid = group(screen_name)bysort date2 userid: gen N_du = _N**** Coding TREATMENT (Adamowicz) *******	gen dayC_ada = date2 - 21562gen dayC_sq_ada = dayC_ada*dayC_adagen dayC_cu_ada = dayC_ada*dayC_ada*dayC_adagen post_ada = date2>=21562gen dayC_post_ada = dayC_ada*post_adagen dayC_sq_post_ada = dayC_sq_ada*post_adagen dayC_cu_post_ada = dayC_cu_ada*post_adagen dayC_opos_ada = dayC_ada*oppositiongen dayC_sq_opos_ada = dayC_sq_ada*oppositiongen dayC_cu_opos_ada = dayC_cu_ada*oppositiongen dayC_opos_post_ada = dayC_ada*opposition*post_adagen dayC_sq_opos_post_ada = dayC_sq_ada*opposition*post_adagen dayC_cu_opos_post_ada = dayC_cu_ada*opposition*post_adagen post_opo_ada = post_ada*oppositiongen post_gob_ada = post_ada*governmentgen hour_sq = hour*hourgen hour_cu = hour*hour*hourbysort userid: gen n_u = _ngen ffd_dayssinceE_ada = 99999gen ffd_targetdate_ada = 21562foreach targetdate in 21562 {	replace ffd_dayssinceE_ada = (date2-`targetdate') if (abs(date2-`targetdate')<=abs(ffd_dayssinceE_ada))	replace ffd_targetdate_ada = `targetdate' if (abs(date2-`targetdate')<=abs(ffd_dayssinceE_ada))}gen event_days_ada = date2-21562gen timeWindow0_ada = ffd_dayssinceE_ada>-3 & ffd_dayssinceE_ada<2gen timeWindow1_ada = ffd_dayssinceE_ada>-6 & ffd_dayssinceE_ada<5gen timeWindow2_ada = ffd_dayssinceE_ada>-11 & ffd_dayssinceE_ada<10gen timeWindow3_ada = ffd_dayssinceE_ada>-16 & ffd_dayssinceE_ada<15gen timeWindow4_ada = ffd_dayssinceE_ada>-21 & ffd_dayssinceE_ada<20gen timeWindow5_ada = ffd_dayssinceE_ada>-31 & ffd_dayssinceE_ada<30**** Coding TREATMENT (Placebo) *******	gen dayC_placebo = date2 - 21547gen dayC_sq_placebo = dayC_placebo*dayC_placebogen dayC_cu_placebo = dayC_placebo*dayC_placebo*dayC_placebogen post_placebo = date2>=21457gen dayC_post_placebo = dayC_placebo*post_placebogen dayC_sq_post_placebo = dayC_sq_placebo*post_placebogen dayC_cu_post_placebo = dayC_cu_placebo*post_placebogen dayC_opos_placebo = dayC_placebo*oppositiongen dayC_sq_opos_placebo = dayC_sq_placebo*oppositiongen dayC_cu_opos_placebo = dayC_cu_placebo*oppositiongen dayC_opos_post_placebo = dayC_placebo*opposition*post_placebogen dayC_sq_opos_post_placebo = dayC_sq_placebo*opposition*post_placebogen dayC_cu_opos_post_placebo = dayC_cu_placebo*opposition*post_placebogen post_opo_placebo = post_placebo*oppositiongen post_gob_placebo = post_placebo*governmentgen ffd_dayssinceE_placebo = 99999gen ffd_targetdate_placebo = 21547foreach targetdate in 21547 {	replace ffd_dayssinceE_placebo = (date2-`targetdate') if (abs(date2-`targetdate')<=abs(ffd_dayssinceE_placebo))	replace ffd_targetdate_placebo = `targetdate' if (abs(date2-`targetdate')<=abs(ffd_dayssinceE_placebo))}gen event_days_placebo = date2-21547gen timeWindow0_placebo = ffd_dayssinceE_placebo>-3 & ffd_dayssinceE_placebo<2gen timeWindow1_placebo = ffd_dayssinceE_placebo>-6 & ffd_dayssinceE_placebo<5gen timeWindow2_placebo = ffd_dayssinceE_placebo>-11 & ffd_dayssinceE_placebo<10gen timeWindow3_placebo = ffd_dayssinceE_placebo>-16 & ffd_dayssinceE_placebo<15gen timeWindow4_placebo = ffd_dayssinceE_placebo>-21 & ffd_dayssinceE_placebo<20gen timeWindow5_placebo = ffd_dayssinceE_placebo>-31 & ffd_dayssinceE_placebo<30**** Coding TREATMENT (WOSP) *******gen dayC_wosp = date2 - 21198gen dayC_sq_wosp = dayC_wosp*dayC_wospgen dayC_cu_wosp = dayC_wosp*dayC_wosp*dayC_wospgen post_wosp = date2>=21198gen dayC_post_wosp = dayC_wosp*post_wospgen dayC_sq_post_wosp = dayC_sq_wosp*post_wospgen dayC_cu_post_wosp = dayC_cu_wosp*post_wospgen dayC_opos_wosp = dayC_wosp*oppositiongen dayC_sq_opos_wosp = dayC_sq_wosp*oppositiongen dayC_cu_opos_wosp = dayC_cu_wosp*oppositiongen dayC_opos_post_wosp = dayC_wosp*opposition*post_wospgen dayC_sq_opos_post_wosp = dayC_sq_wosp*opposition*post_wospgen dayC_cu_opos_post_wosp = dayC_cu_wosp*opposition*post_wospgen post_opo_wosp = post_wosp*oppositiongen post_gob_wosp = post_wosp*governmentgen ffd_dayssinceE_wosp = 99999gen ffd_targetdate_wosp = 21198foreach targetdate in 21198 {	replace ffd_dayssinceE_wosp = (date2-`targetdate') if (abs(date2-`targetdate')<=abs(ffd_dayssinceE_wosp))	replace ffd_targetdate_wosp = `targetdate' if (abs(date2-`targetdate')<=abs(ffd_dayssinceE_wosp))}gen event_days_wosp = date2-21198gen timeWindow0_wosp = ffd_dayssinceE_wosp>-3 & ffd_dayssinceE_wosp<2gen timeWindow1_wosp = ffd_dayssinceE_wosp>-6 & ffd_dayssinceE_wosp<5gen timeWindow2_wosp = ffd_dayssinceE_wosp>-11 & ffd_dayssinceE_wosp<10gen timeWindow3_wosp = ffd_dayssinceE_wosp>-16 & ffd_dayssinceE_wosp<15gen timeWindow4_wosp = ffd_dayssinceE_wosp>-21 & ffd_dayssinceE_wosp<20gen timeWindow5_wosp = ffd_dayssinceE_wosp>-31 & ffd_dayssinceE_wosp<30**** Coding OTHER MENTIONS *******replace text = " " + textgen opMentions = strpos(text," rzd") + strpos(text," min ") + strpos(text,"minist") + strpos(text,"wicemin") + strpos(text,"pis ") + strpos(text,"tvp") + strpos(text,"andruszkiewicz") + strpos(text,"berni_krynick") + strpos(text,"budet") + strpos(text,"premier") + strpos(text,"morawieck") + strpos(text,"pisowsk") + strpos(text,"macierewicz") + strpos(text,"kaczysk") + strpos(text," msz ") + strpos(text,"tygodnik_sieci") + strpos(text,"smolesk") + strpos(text,"misiewicz") + strpos(text,"tasmykaczynsk") + strpos(text,"glapiski") + strpos(text,"glapinski") + strpos(text,"szydo") + strpos(text,"ziobro") + strpos(text,"zieliski") + strpos(text,"gowin") + strpos(text,"jbrudzinski") + strpos(text,"drelich") + strpos(text,"terlecki") + strpos(text,"sdownictw") + strpos(text,"pisorgpl") + strpos(text," nbp ") + strpos(text,"wicemarsz") + strpos(text," cba ") + strpos(text,"patryk jaki") + strpos(text,"policj") + strpos(text,"czaputowicz") + strpos(text,"gliski")replace opMentions = opMentions>0gen govMentions = strpos(text," opozycj") + strpos(text,"bzdrojewski") + strpos(text," lewic") + strpos(text,"olejnik") + strpos(text," lewicow") + strpos(text," biedro") + strpos(text," lewac") + strpos(text," psl_") + strpos(text," psl ") + strpos(text,"gazwyb") + strpos(text," nowick") + strpos(text," sikorsk") + strpos(text,"schetyn") + strpos(text," neuman") + strpos(text,"tomasz_lis") + strpos(text,"tomasz lis") + strpos(text," lis_tomasz") + strpos(text," tusk") + strpos(text," platform") + strpos(text,"trzaskowski_") + strpos(text,"platforma_org") + strpos(text,"klubnauer") + strpos(text," gw_") + strpos(text,"gazetawyborcza") + strpos(text,"tvn24")replace govMentions = govMentions>0replace govMentions = govMentions + strpos(text,"platforma_org")>0replace govMentions = govMentions + strpos(text,"tomaszsiemoniak")>0replace govMentions = govMentions + strpos(text,"arlukowicz")>0replace govMentions = govMentions + strpos(text,"bbudka")>0replace govMentions = govMentions + strpos(text,"andrzejhalicki")>0replace govMentions = govMentions + strpos(text,"slawekneumann")>0replace govMentions = govMentions + strpos(text,"schetynadlapo")>0replace govMentions = govMentions + strpos(text,"mkierwinski")>0replace govMentions = govMentions + strpos(text,"jangrabiec")>0replace govMentions = govMentions + strpos(text,"achybicka")>0replace govMentions = govMentions + strpos(text,"protasiewiczj")>0replace govMentions = govMentions + strpos(text,"zpawlowicz")>0replace govMentions = govMentions + strpos(text,"trzaskowski_")>0replace govMentions = govMentions + strpos(text,"tomaszlenz")>0replace govMentions = govMentions + strpos(text,"hannagw")>0replace govMentions = govMentions + strpos(text,"asia_mucha")>0replace govMentions = govMentions + strpos(text,"niesiolowskis")>0replace govMentions = govMentions + strpos(text,"bbukiewicz")>0replace govMentions = govMentions + strpos(text,"c_grabarczyk")>0replace govMentions = govMentions + strpos(text,"ikatarasinska")>0replace govMentions = govMentions + strpos(text,"ctomczyk")>0replace govMentions = govMentions + strpos(text,"sowamarek")>0replace govMentions = govMentions + strpos(text,"ireneuszras")>0replace govMentions = govMentions + strpos(text,"kopacz_ewa")>0replace govMentions = govMentions + strpos(text,"m_k_blonska")>0replace govMentions = govMentions + strpos(text,"adam_korol")>0replace govMentions = govMentions + strpos(text,"pomaska")>0replace govMentions = govMentions + strpos(text,"henryka_henia50")>0replace govMentions = govMentions + strpos(text,"miroslawanykiel")>0replace govMentions = govMentions + strpos(text,"marianzembala")>0replace govMentions = govMentions + strpos(text,"urszulaaugustyn")>0replace govMentions = govMentions + strpos(text,"kr_szumilas")>0replace govMentions = govMentions + strpos(text,"okladrewnowicz")>0replace govMentions = govMentions + strpos(text,"mswitczak")>0replace govMentions = govMentions + strpos(text,"jakubrutnicki")>0replace govMentions = govMentions + strpos(text,"mjanyska")>0replace govMentions = govMentions + strpos(text,"ziolkowskiszym")>0replace govMentions = govMentions + strpos(text,"waldydzikowski")>0replace govMentions = govMentions + strpos(text,"slawomirnitras")>0replace govMentions = govMentions + strpos(text,"krzysztofbrejza")>0replace govMentions = govMentions + strpos(text,"arkadiuszmyrcha")>0replace govMentions = govMentions + strpos(text,"mwielichowska")>0replace govMentions = govMentions + strpos(text,"gajewska_kinga")>0replace govMentions = govMentions + strpos(text,"newsplatforma")>0replace govMentions = govMentions + strpos(text,"grzegorzfurgo")>0replace govMentions = govMentions + strpos(text,"bborusewicz")>0replace govMentions = govMentions + strpos(text,"tomaszsiemoniak")>0replace govMentions = govMentions + strpos(text,"rtyszkiewicz")>0replace govMentions = govMentions + strpos(text,"jaroslawduda")>0replace govMentions = govMentions + strpos(text,"zdzislaw_gawlik")>0replace govMentions = govMentions + strpos(text,"arturgierada")>0replace govMentions = govMentions + strpos(text,"a_marchewka")>0replace govMentions = govMentions + strpos(text,"jacek_protas")>0replace govMentions = govMentions + strpos(text,"wojciechsaluga")>0replace govMentions = govMentions + strpos(text,"wslugocki")>0replace govMentions = govMentions + strpos(text,"hannazdanowska")>0replace govMentions = govMentions + strpos(text,"prezydentzuk")>0replace govMentions = govMentions + strpos(text,"izabela_debska")>0replace govMentions = govMentions + strpos(text,"tadeuszzwiefka")>0replace govMentions = govMentions + strpos(text,"donaldtusk")>0replace opMentions = opMentions + strpos(text,"piotr_naimski")>0replace opMentions = opMentions + strpos(text,"pisorgpl")>0replace opMentions = opMentions + strpos(text,"morawieckim")>0replace opMentions = opMentions + strpos(text,"jbrudzinski")>0replace opMentions = opMentions + strpos(text,"patrykjaki")>0replace opMentions = opMentions + strpos(text,"andzyberto")>0replace opMentions = opMentions + strpos(text,"kurskipl")>0replace opMentions = opMentions + strpos(text,"piotrglinski")>0replace opMentions = opMentions + strpos(text,"jaroslaw_gowin")>0replace opMentions = opMentions + strpos(text,"stkarczewski")>0replace opMentions = opMentions + strpos(text,"marekkuchcinski")>0replace opMentions = opMentions + strpos(text,"beataszydlo")>0replace opMentions = opMentions + strpos(text,"beatamk")>0replace opMentions = opMentions + strpos(text,"e_rafalska")>0replace opMentions = opMentions + strpos(text,"krystpawlowicz")>0replace opMentions = opMentions + strpos(text,"ziobropl")>0replace opMentions = opMentions + strpos(text,"beatakempa_kprm")>0replace opMentions = opMentions + strpos(text,"mblaszczak")>0replace opMentions = opMentions + strpos(text,"macierewicz_a")>0replace opMentions = opMentions + strpos(text,"elzbietawitek")>0replace opMentions = opMentions + strpos(text,"_annazalewska")>0replace opMentions = opMentions + strpos(text,"michaldworczyk")>0replace opMentions = opMentions + strpos(text,"latostomasz")>0replace opMentions = opMentions + strpos(text,"slawzawislak")>0replace opMentions = opMentions + strpos(text,"wassermann_ma")>0replace opMentions = opMentions + strpos(text,"arekmularczyk")>0replace opMentions = opMentions + strpos(text,"w_bernacki")>0replace opMentions = opMentions + strpos(text,"mareksuski")>0replace opMentions = opMentions + strpos(text,"akosztowniak")>0replace opMentions = opMentions + strpos(text,"minenergii")>0replace opMentions = opMentions + strpos(text,"a_czartoryski")>0replace opMentions = opMentions + strpos(text,"mariuszkaminsk")>0replace opMentions = opMentions + strpos(text,"sasinjacek ?")>0replace opMentions = opMentions + strpos(text,"bogdan_rzonca")>0replace opMentions = opMentions + strpos(text,"andrzejszlachta")>0replace opMentions = opMentions + strpos(text,"mrirw_gov_pl")>0replace opMentions = opMentions + strpos(text,"d_piontkowski")>0replace opMentions = opMentions + strpos(text,"mkidn_gov_pl")>0replace opMentions = opMentions + strpos(text,"stanislaw_szwed")>0replace opMentions = opMentions + strpos(text,"szymongizynski")>0replace opMentions = opMentions + strpos(text,"izabelakloc")>0replace opMentions = opMentions + strpos(text,"andrzejduda")>0replace opMentions = opMentions + strpos(text,"annamkrupka")>0replace opMentions = opMentions + strpos(text,"iwonaarent")>0replace opMentions = opMentions + strpos(text,"joannalichocka")>0replace opMentions = opMentions + strpos(text,"witoldczarneck3")>0replace opMentions = opMentions + strpos(text,"tadeuszdziuba")>0replace opMentions = opMentions + strpos(text,"zagorskimarek")>0replace opMentions = opMentions + strpos(text,"marekgrobarczyk")>0replace opMentions = opMentions + strpos(text,"amadamczyk")>0replace opMentions = opMentions + strpos(text,"jerzykwiecinski")>0replace opMentions = opMentions + strpos(text,"jemilewicz")>0replace opMentions = opMentions + strpos(text,"witoldbanka")>0replace opMentions = opMentions + strpos(text,"jczaputowicz")>0replace opMentions = opMentions + strpos(text,"szumowskilukasz")>0replace opMentions = opMentions + strpos(text,"j_kopcinska")>0replace opMentions = opMentions + strpos(text,"profkarski")>0replace opMentions = opMentions + strpos(text,"ryszardterlecki")>0replace opMentions = opMentions + strpos(text,"r_czarnecki")>0replace opMentions = opMentions + strpos(text,"grzegorzczelej")>0replace opMentions = opMentions + strpos(text,"anita_cz")>0replace opMentions = opMentions + strpos(text,"ministerjurgiel")>0replace opMentions = opMentions + strpos(text,"cymanskitadeusz")>0replace opMentions = opMentions + strpos(text,"jacekzalek")>0gen mentionOther = (opMentions & opposition) | (govMentions & government)replace mentionOther = 0 if mentionOther == .**** Coding other VARIABLES *******gen post_mention_ada = post_ada*mentionOthergen post_opo_mention_ada = post_ada*opposition*mentionOthergen opo_mention = opposition*mentionOthergen mention_ada = mentionOther*gg_adamowiczgen opo_ada = opposition*gg_adamowiczgen mention_opo_ada= mentionOther*gg_adamowicz*oppositiondrop n_ubysort userid: gen n_u=_nbysort userid: gen N_u=_Ndrop if N_u<10reg log_engagement i.userid if !post_adapredict popularityegen popRankT = rank(-popularity) if n_u==1 & opposition, uniquebysort userid: egen popRankO = mean(popRankT)drop popRankTegen popRankT = rank(-popularity) if n_u==1 & government, uniquebysort userid: egen popRankG = mean(popRankT)drop popRankTgen popRankWithin = popRankG if governmentreplace popRankWithin = popRankO if oppositionegen popRankT = rank(-popularity) if n_u==1, uniquebysort userid: egen popRank = mean(popRankT)drop popRankTreg mentionOther i.userid if post_adapredict mentionersum mentioner if n_u==1 & opposition, detlabel variable post_opo_ada "Post x opposition"label variable opposition "Opposition"label variable post_ada "Post"label variable mentionOther "Mention rival"label variable post_mention_ada "Post x Mention rival"bysort userid: egen meanNGallT = mean(mentionOther) if !post_adabysort userid: egen meanNGall = mean(meanNGallT)drop meanNGallTgen post_ngA = post_ada*mentionerlabel variable post_ngA "Post x Negative campaigner"bysort userid: egen meanPopT = mean(log_engagement) if !post_adabysort userid: egen meanPop = mean(meanPopT)drop meanPopTgen post_pop = post_ada*meanPoplabel variable post_pop "Post x popularity"gen event_days_ada_M = event_days_ada+1000replace event_days_ada_M=. if event_days_ada_M<0bysort userid date2: gen n_tweets=_Nbysort userid date2: gen _tweets=_ngen log_n_tweets=ln(n_tweets)gen event_days_placebo_M = event_days_placebo+1000replace event_days_placebo_M=. if event_days_placebo_M<0gen event_days_wosp_M = event_days_wosp+1000replace event_days_wosp_M=. if event_days_wosp_M<0gen post_mp_ada = post_ada*mpgen post_opo_mp = post_opo_ada*mplabel variable post_mp_ada "Post x MP"label variable post_opo_mp "Post x MP x opposition"***** TABLES **********Table 1 **** eststo cleareststo, title("Engagement"): reghdfe log_engagement post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"esttab using "${PathTab}Table1.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(post_opo_ada) stats(N pFE dFE controls, fmt(0) labels("N" "Day FE" "Politician FE" "Controls")) label nodepvar mtitles title("Violent attack and Twitter engagement") replace nonotes postfoot(" ")***Table 2  **** eststo cleareststo, title("Engagement"): reghdfe log_engagement post_opo_ada mentionOther post_mention_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_opo_ada mentionOther post_mention_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_opo_ada mentionOther post_mention_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"esttab using "${PathTab}Table2.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(post_opo_ada mentionOther post_mention_ada) stats(N pFE dFE controls, fmt(0) labels("N" "Day FE" "Politician FE" "Controls")) label nodepvar mtitles title("Violent attack and Twitter engagement: Negative campaiging effect") replace nonotes postfoot(" ")***Table A4 **** eststo cleareststo, title("Engagement"): reghdfe log_engagement post_opo_ada post_mp_ada post_opo_mp  hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_opo_ada post_mp_ada post_opo_mp hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_opo_ada post_mp_ada post_opo_mp hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"esttab using "${PathTab}TableA4.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(post_opo_ada post_mp_ada post_opo_mp) stats(N pFE dFE controls, fmt(0) labels("N" "Day FE" "Politician FE" "Controls")) label nodepvar mtitles title("Violent attack and Twitter engagement: Interactions with MP status") replace nonotes postfoot(" ")***Table A5 **** bys post_ada government: sum rt_count  if timeWindow3_ada  & !gg_rt & mpbys post_ada government: sum favcount  if timeWindow3_ada  & !gg_rt & mp**** Table A8  ****eststo cleareststo, title("Engagment"): reghdfe log_engagement post_ngA hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_ngA hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_ngA hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Engagment"): reghdfe log_engagement post_opo_ada post_ngA hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_opo_ada post_ngA hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_opo_ada post_ngA hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"esttab using "${PathTab}TableA8.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(post_opo_ada post_ngA) stats(N pFE dFE controls, fmt(0) labels("N" "Day FE" "Politician FE" "Controls")) label nodepvar mtitles title("Violent attack and Twitter engagement: Negative campaiging effect") replace nonotes postfoot(" ")**** Tables A10****eststo cleareststo, title("Engagement"): reghdfe log_engagement post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow2_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow2_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow2_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Engagement"): reghdfe log_engagement post_opo_ada mentionOther post_mention_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow2_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_opo_ada mentionOther post_mention_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow2_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_opo_ada mentionOther post_mention_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow2_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"esttab using "${PathTab}TableA10.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(post_opo_ada mentionOther post_mention_ada) stats(N pFE dFE controls, fmt(0) labels("N" "Day FE" "Politician FE" "Controls")) label nodepvar mtitles title("Violent attack and Twitter engagement (10-day window)") replace nonotes postfoot(" ")**** Tables A11 ****eststo cleareststo, title("Engagement"): reghdfe log_engagement post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow4_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow4_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow4_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Engagement"): reghdfe log_engagement post_opo_ada mentionOther post_mention_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow4_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_opo_ada mentionOther post_mention_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow4_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_opo_ada mentionOther post_mention_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow4_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"esttab using "${PathTab}TableA11.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(post_opo_ada mentionOther post_mention_ada) stats(N pFE dFE controls, fmt(0) labels("N" "Day FE" "Politician FE" "Controls")) label nodepvar mtitles title("Violent attack and Twitter engagement (20-day window)") replace nonotes postfoot(" ")**** Tables A12 ****eststo cleareststo, title("Engagement"): reghdfe log_engagement post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow5_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow5_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow5_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Engagement"): reghdfe log_engagement post_opo_ada mentionOther post_mention_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow5_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_opo_ada mentionOther post_mention_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow5_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_opo_ada mentionOther post_mention_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow5_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"esttab using "${PathTab}TableA12.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(post_opo_ada mentionOther post_mention_ada) stats(N pFE dFE controls, fmt(0) labels("N" "Day FE" "Politician FE" "Controls")) label nodepvar mtitles title("Violent attack and Twitter engagement (30-day window)") replace nonotes postfoot(" ")***Table A13 ****label variable opo_ada "Mention Adamowicz x opposition"label variable gg_adamowicz "Mention Adamowicz"eststo cleareststo, title("Engagement"): reghdfe log_engagement gg_adamowicz opo_ada hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt gg_adamowicz opo_ada hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav gg_adamowicz opo_ada hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local controls = "Yes"esttab using "${PathTab}TableA13.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(gg_adamowicz opo_ada) stats(N controls, fmt(0) labels("N" "Controls")) label nodepvar mtitles title("Adamowicz Mentions and Twitter engagement") replace nonotes postfoot(" ")***Table A14 **** eststo clear* eststo, title("Engagement"): reg log_engagement post_ada post_opo_ada if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid)* estadd local dFE = "No"* estadd local pFE = "No"* estadd local controls = "No"* eststo, title("Retweets"): reg log_rt post_ada post_opo_ada if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid)* estadd local dFE = "No"* estadd local pFE = "No"* estadd local controls = "No"* eststo, title("Likes"): reg log_fav post_ada post_opo_ada if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid)* estadd local dFE = "No"* estadd local pFE = "No"* estadd local controls = "No"eststo, title("Engagement"): reghdfe log_engagement post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"esttab using "${PathTab}TableA14.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(post_opo_ada) stats(N pFE dFE controls, fmt(0) labels("N" "Day FE" "Politician FE" "Controls")) label nodepvar mtitles title("Violent attack and Twitter engagement (tweets about Adamowicz excluded)") replace nonotes postfoot(" ")***Table A15 ****eststo cleareststo, title("Engagment"): reghdfe log_engagement post_pop hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid) abs(userid date2)estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_pop hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid) abs(userid date2)estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_pop hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & !gg_adamowicz, cl(userid) abs(userid date2)estadd local controls = "Yes"esttab using "${PathTab}TableA15.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(post_pop) stats(N controls, fmt(0) labels("N" "Controls")) label nodepvar mtitles title("Violent attack and Twitter engagement (interaction with pre-attack popularity)") replace nonotes postfoot(" ")***Table A16 ****label variable log_n_tweets "Log tweets"eststo cleareststo, title("Engagment"): reghdfe log_engagement log_n_tweets, abs(userid date2)estadd local controls = "No"esttab using "${PathTab}TableA16.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(log_n_tweets) stats(N controls, fmt(0) labels("N" "Controls")) label nodepvar mtitles title("Twitter production and Twitter engagement") replace nonotes postfoot(" ")**** Table A17 ****eststo cleareststo, title("Engagement"): reghdfe log_engagement post_opo_ada hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & popularity<3.05073, cl(userid) abs(userid date2)estadd local controls = "Yes"eststo, title("Retweets"): reghdfe log_rt post_opo_ada hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & popularity<3.05073, cl(userid) abs(userid date2)estadd local controls = "Yes"eststo, title("Likes"): reghdfe log_fav post_opo_ada hour_sq hour_cu gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt & popularity<3.05073, cl(userid) abs(userid date2)estadd local controls = "Yes"esttab using "${PathTab}TableA17.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(post_opo_ada) stats(N controls, fmt(0) labels("N" "Controls")) label nodepvar mtitles title("Violent attack and Twitter engagement (50\% most popular)") replace nonotes postfoot(" ")***Table A21 **** gen totaleng = favcount + rt_counteststo cleareststo, title("Engagement"): reghdfe totaleng post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Retweets"): reghdfe rt_count post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"eststo, title("Likes"): reghdfe favcount post_opo_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)estadd local dFE = "Yes"estadd local pFE = "Yes"estadd local controls = "Yes"esttab using "${PathTab}TableA21.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(post_opo_ada) stats(N pFE dFE controls, fmt(0) labels("N" "Day FE" "Politician FE" "Controls")) label nodepvar mtitles title("Violent attack and Twitter engagement (levels)") replace nonotes postfoot(" ")***********FIGURES**************** FIGURE 2 ****reghdfe log_engagement ib1014.event_days_ada_M##opposition if timeWindow3_ada & !gg_rt, cl(userid) abs(userid)preserve	regsave, ci	gen days = _n	drop if coef==0 & days>30	drop days	gen days = _n	set obs `=_N+1' 	replace coef = 0 in 60	replace days = 60 in 60	gen opo = (days>30)	replace days = days-30 if opo	forvalues var =1(1)30 {		sum coef if days==`var' & !opo		replace coef = coef+r(mean) if opo & days==`var'	}	replace days = days-15	sum coef if days==-1 & !opo	gen coef_n = coef-r(mean) if !opo	sum coef if days==-1 & opo	replace coef_n = coef-r(mean) if opo	graph twoway (lpoly coef_n days if opo & days<0, lp(dash) bwidth(7) color(orange) msize(small) graphregion(color(white)) legend( cols(1) order(1 "Opposition" 3 "Government")) ytitle("Tweet engagement", size(large)) xtitle("Days since event", size(large)) lwidth(0.3 0.3) tline(0, lp(solid) lc(grey)) graphregion(lwidth(large))) (lpoly coef_n days if opo & days>0, lp(dash) bwidth(7) color(orange) msize(small)) (lpoly coef_n days if !opo & days<0, bwidth(7) lp(line) color(navy) msize(small)) (lpoly coef_n days if !opo & days>0, bwidth(7) lp(line) color(navy) msize(small)) (lpolyci coef_n days if opo & days<0, bwidth(7) pwidth(7) level(90) lwidth(none) color(orange%20)) (lpolyci coef_n days if opo & days>0, bwidth(7) pwidth(7) level(90) lwidth(none) color(orange%20)) (lpolyci coef_n days if !opo & days>0, bwidth(7) pwidth(7) level(90) lwidth(none) color(navy%20)) (lpolyci coef_n days if !opo & days<0, bwidth(7) pwidth(7) level(90) lwidth(none) color(navy%20)) (scatter coef_n days if !opo & coef_n>-1, msymbol(square) color(navy) msize(small)) (scatter coef_n days if opo & coef_n>-1, color(orange) msymbol(triangle) msize(small))	graph export "${PathFig}Figure2.png", replacerestore**** FIGURE 4 ****reghdfe log_engagement ib1014.event_days_ada_M##mentionOther if timeWindow3_ada & !gg_rt, abs(userid)preserve	regsave, ci	gen days = _n	drop if coef==0 & days>29	/*we drop in 29 instead of 30 because of extra 0*/	drop days	gen days = _n	set obs `=_N+1' 	replace coef = 0 in 30	replace coef = 0 in 60	replace days = 60 in 60	gen menOt = (days>30)	replace days = days-30 if menOt	forvalues var =1(1)30 {		sum coef if days==`var' & !menOt		replace coef = coef+r(mean) if menOt & days==`var'	}	replace days = days-15	sum coef if days==-1 & !menOt	gen coef_n = coef-r(mean) if !menOt	sum coef if days==-1 & menOt	replace coef_n = coef-r(mean) if menOt	graph twoway (lpoly coef_n days if menOt & days<0, lp(dash) bwidth(7) color(red) msize(small) graphregion(color(white)) legend( cols(1) order(1 "Mention rival" 3 "Not mention rival")) ytitle("Tweet engagement", size(large)) xtitle("Days since event", size(large)) lwidth(0.3 0.3) tline(0, lp(solid) lc(grey)) graphregion(lwidth(large))) (lpoly coef_n days if menOt & days>0, lp(dash) bwidth(7) color(red) msize(small)) (lpoly coef_n days if !menOt & days<0, bwidth(7) lp(line) color(eltgreen) msize(small)) (lpoly coef_n days if !menOt & days>0, bwidth(7) lp(line) color(eltgreen) msize(small)) (lpolyci coef_n days if menOt & days<0, bwidth(7) pwidth(7) level(90) lwidth(none) color(red%20)) (lpolyci coef_n days if menOt & days>0, bwidth(7) pwidth(7) level(90) lwidth(none) color(red%20)) (lpolyci coef_n days if !menOt & days>0, bwidth(7) pwidth(7) level(90) lwidth(none) color(eltgreen%20)) (lpolyci coef_n days if !menOt & days<0, bwidth(7) pwidth(7) level(90) lwidth(none) color(eltgreen%20)) (scatter coef_n days if !menOt & coef_n>-1 & coef_n<1, msymbol(Oh) color(eltgreen) msize(small)) (scatter coef_n days if menOt & coef_n>-1 & coef_n<1, color(red) msymbol(X) msize(medium))		graph export "${PathFig}Figure4.png", width(3600) as(png) replacerestore***Figure A3 **** eststo cleareststo, title("Engagement"): reghdfe log_engagement post_opo_ada##post_mp_ada  hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)margins, dydx(post_opo_ada) at(post_mp_ada=(0(1)1))marginsplot, recast(dot) yline(0) level(90) saving(margins1.gph, replace)eststo, title("Retweets"): reghdfe log_rt post_opo_ada##post_mp_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)margins, dydx(post_opo_ada) at(post_mp_ada=(0(1)1))marginsplot, recast(dot) yline(0) level(90) saving(margins2.gph, replace)eststo, title("Likes"): reghdfe log_fav post_opo_ada##post_mp_ada hour_sq hour gg_hashtag gg_at gg_reply gg_rt gg_http if timeWindow3_ada & !gg_rt, cl(userid) abs(userid date2)margins, dydx(post_opo_ada) at(post_mp_ada=(0(1)1))marginsplot, recast(dot) yline(0) level(90) saving(margins3.gph, replace)graph combine margins1.gph margins2.gph  margins3.gph, xcommon ycommon**** FIGURE A4 ****reghdfe log_engagement ib1014.event_days_placebo_M##opposition if timeWindow3_placebo & !gg_rt, cl(userid) abs(userid)preserve	regsave, ci	gen days = _n	drop if coef==0 & days>30	drop days	gen days = _n	set obs `=_N+1' 	replace coef = 0 in 60	replace days = 60 in 60	gen opo = (days>30)	replace days = days-30 if opo	forvalues var =1(1)30 {		sum coef if days==`var' & !opo		replace coef = coef+r(mean) if opo & days==`var'	}	replace days = days-15	sum coef if days==14 & !opo	gen coef_n = coef-r(mean) if !opo	sum coef if days==14 & opo	replace coef_n = coef-r(mean) if opo	graph twoway (lpoly coef_n days if opo & days<0, lp(dash) bwidth(7) color(orange) msize(small)) (lpoly coef_n days if opo & days>0, lp(dash) bwidth(7) color(orange) msize(small)) (lpoly coef_n days if !opo & days<0, bwidth(7) lp(line) color(navy) msize(small)) (lpoly coef_n days if !opo & days>0, bwidth(7) lp(line) color(navy) msize(small)) (scatter coef_n days if !opo & coef_n>-1, msymbol(square) color(navy) msize(small)) (scatter coef_n days if opo & coef_n>-1, msymbol(triangle) msize(small) graphregion(color(white)) legend( cols(1) order(6 "Opposition" 5 "Government")) ytitle("Tweet engagement", size(large)) xtitle("Days since event", size(large)) lwidth(0.3 0.3) color(orange) tline(0, lp(solid) lc(grey)) graphregion(lwidth(large))) (lpolyci coef_n days if opo & days<0, bwidth(7) pwidth(7) level(90) lwidth(none) color(orange%20)) (lpolyci coef_n days if opo & days>0, bwidth(7) pwidth(7) level(90) lwidth(none) color(orange%20)) (lpolyci coef_n days if !opo & days>0, bwidth(7) pwidth(7) level(90) lwidth(none) color(navy%20)) (lpolyci coef_n days if !opo & days<0, bwidth(7) pwidth(7) level(90) lwidth(none) color(navy%20))		graph export "${PathFig}FigureA4.png", width(3600) as(png) replacerestore**** FIGURE A5 ****reghdfe log_engagement ib1014.event_days_wosp_M##opposition if timeWindow3_wosp & !gg_rt, cl(userid) abs(userid)preserve	regsave, ci	gen days = _n	drop if coef==0 & days>30	drop days	gen days = _n	set obs `=_N+1' 	replace coef = 0 in 60	replace days = 60 in 60	gen opo = (days>30)	replace days = days-30 if opo	forvalues var =1(1)30 {		sum coef if days==`var' & !opo		replace coef = coef+r(mean) if opo & days==`var'	}	replace days = days-15	sum coef if days==14 & !opo	gen coef_n = coef-r(mean) if !opo	sum coef if days==14 & opo	replace coef_n = coef-r(mean) if opo	graph twoway (lpoly coef_n days if opo & days<0, lp(dash) bwidth(7) color(orange) msize(small)) (lpoly coef_n days if opo & days>0, lp(dash) bwidth(7) color(orange) msize(small)) (lpoly coef_n days if !opo & days<0, bwidth(7) lp(line) color(navy) msize(small)) (lpoly coef_n days if !opo & days>0, bwidth(7) lp(line) color(navy) msize(small)) (scatter coef_n days if !opo & coef_n>-1, msymbol(square) color(navy) msize(small)) (scatter coef_n days if opo & coef_n>-1, msymbol(triangle) msize(small) graphregion(color(white)) legend( cols(1) order(6 "Opposition" 5 "Government")) ytitle("Tweet engagement", size(large)) xtitle("Days since event", size(large)) lwidth(0.3 0.3) color(orange) tline(0, lp(solid) lc(grey)) graphregion(lwidth(large))) (lpolyci coef_n days if opo & days<0, bwidth(7) pwidth(7) level(90) lwidth(none) color(orange%20)) (lpolyci coef_n days if opo & days>0, bwidth(7) pwidth(7) level(90) lwidth(none) color(orange%20)) (lpolyci coef_n days if !opo & days>0, bwidth(7) pwidth(7) level(90) lwidth(none) color(navy%20)) (lpolyci coef_n days if !opo & days<0, bwidth(7) pwidth(7) level(90) lwidth(none) color(navy%20))		graph export "${PathFig}FigureA5.png", width(3600) as(png) replacerestore**** FIGURE A6 ****reghdfe log_n_tweets ib1014.event_days_ada_M##opposition if _tweets==1 & timeWindow3_ada, cl(userid) abs(userid) preserve	regsave, ci	gen days = _n	drop if coef==0 & days>30	drop days	gen days = _n	set obs `=_N+1' 	replace coef = 0 in 60	replace days = 60 in 60	gen opo = (days>30)	replace days = days-30 if opo	forvalues var =1(1)30 {		sum coef if days==`var' & !opo		replace coef = coef+r(mean) if opo & days==`var'	}	replace days = days-15	sum coef if days==-1 & !opo	gen coef_n = coef-r(mean) if !opo	sum coef if days==-1 & opo	replace coef_n = coef-r(mean) if opo	graph twoway (lpoly coef_n days if opo & days<0, lp(dash) bwidth(7) color(orange) msize(small)) (lpoly coef_n days if opo & days>0, lp(dash) bwidth(7) color(orange) msize(small)) (lpoly coef_n days if !opo & days<0, bwidth(7) lp(line) color(navy) msize(small)) (lpoly coef_n days if !opo & days>0, bwidth(7) lp(line) color(navy) msize(small)) (scatter coef_n days if !opo, msymbol(square) color(navy) msize(small)) (scatter coef_n days if opo & coef_n<.5, msymbol(triangle) msize(small) graphregion(color(white)) legend( cols(1) order(6 "Opposition" 5 "Government")) ytitle("Twitter production", size(large)) xtitle("Days since event", size(large)) lwidth(0.3 0.3) color(orange) tline(0, lp(solid) lc(grey)) graphregion(lwidth(large))) (lpolyci coef_n days if opo & days<0, bwidth(7) pwidth(7) level(90) lwidth(none) color(orange%20)) (lpolyci coef_n days if opo & days>0, bwidth(7) pwidth(7) level(90) lwidth(none) color(orange%20)) (lpolyci coef_n days if !opo & days>0, bwidth(7) pwidth(7) level(90) lwidth(none) color(navy%20)) (lpolyci coef_n days if !opo & days<0, bwidth(7) pwidth(7) level(90) lwidth(none) color(navy%20))	graph export "${PathFig}FigureA6.png", width(3600) as(png) replacerestore**** FIGURE A11 ****reghdfe log_engagement ib1014.event_days_ada_M##mentionOther if timeWindow3_ada & !gg_rt & !gg_adamowicz, abs(userid)preserve	regsave, ci	gen days = _n	drop if coef==0 & days>29	/*we drop in 29 instead of 30 because of extra 0*/	drop days	gen days = _n	set obs `=_N+1' 	replace coef = 0 in 30	replace coef = 0 in 60	replace days = 60 in 60	gen menOt = (days>30)	replace days = days-30 if menOt	forvalues var =1(1)30 {		sum coef if days==`var' & !menOt		replace coef = coef+r(mean) if menOt & days==`var'	}	replace days = days-15	sum coef if days==-1 & !menOt	gen coef_n = coef-r(mean) if !menOt	sum coef if days==-1 & menOt	replace coef_n = coef-r(mean) if menOt	graph twoway (lpoly coef_n days if menOt & days<0, lp(dash) bwidth(7) color(red) msize(small) graphregion(color(white)) legend( cols(1) order(1 "Mention rival" 3 "Not mention rival")) ytitle("Tweet engagement", size(large)) xtitle("Days since event", size(large)) lwidth(0.3 0.3) tline(0, lp(solid) lc(grey)) graphregion(lwidth(large))) (lpoly coef_n days if menOt & days>0, lp(dash) bwidth(7) color(red) msize(small)) (lpoly coef_n days if !menOt & days<0, bwidth(7) lp(line) color(eltgreen) msize(small)) (lpoly coef_n days if !menOt & days>0, bwidth(7) lp(line) color(eltgreen) msize(small)) (lpolyci coef_n days if menOt & days<0, bwidth(7) pwidth(7) level(90) lwidth(none) color(red%20)) (lpolyci coef_n days if menOt & days>0, bwidth(7) pwidth(7) level(90) lwidth(none) color(red%20)) (lpolyci coef_n days if !menOt & days>0, bwidth(7) pwidth(7) level(90) lwidth(none) color(eltgreen%20)) (lpolyci coef_n days if !menOt & days<0, bwidth(7) pwidth(7) level(90) lwidth(none) color(eltgreen%20)) (scatter coef_n days if !menOt & coef_n>-1 & coef_n<1, msymbol(Oh) color(eltgreen) msize(small)) (scatter coef_n days if menOt & coef_n>-1 & coef_n<1, color(red) msymbol(X) msize(medium))		graph export "${PathFig}FigureA11.png", width(3600) as(png) replacerestore *** CORRELATION w/ VOTES *** preserve	 import excel "${PathData}wybory_pre_post.xlsx", sheet("Sheet1") firstrow clear	 sort screen_name	 save "${PathData}wybory_pre_post.dta", replacerestoresort screen_namemerge screen_name using "${PathData}wybory_pre_post.dta"rename _merge mergeVotesgen log_votesPost = log(vote_post)gen log_votesPre = log(vote_pre)gen log_change = log_votesPost - log_votesPregen vote_change = vote_post/vote_prebysort userid: egen meanNGT = mean(mentionOther) if post_adabysort userid: egen meanNGpostada = mean(meanNGT)drop meanNGTbysort userid: egen meanNGT = mean(mentionOther) if !post_adabysort userid: egen meanNGpreada = mean(meanNGT)drop meanNGTgen NGchange = meanNGpostada - meanNGpreadabysort userid: egen meanPop_T = mean(log_engagement) if post_adabysort userid: egen meanPop_postada = mean(meanPop_T)drop meanPop_Tbysort userid: egen meanPop_T = mean(log_engagement) if !post_adabysort userid: egen meanPop_preada = mean(meanPop_T)drop meanPop_Tgen mean_negCamp_diff = meanNGpostada - meanPop_preada**** Table A25 ****label variable meanNGpostada "Share negative-campaigning tweets post assasination"label variable meanNGpreada "Share negative-campaigning tweets pre assasination"label variable mean_negCamp_diff "Share negative-campaigning (diff post - pre)"label variable log_votesPre "Votes in 2015 (log)"eststo cleareststo, title("Votes in 2019 (log)"): reg log_votesPost meanNGpostada if n_u==1, robusteststo, title("Votes in 2019 (log)"): reg log_votesPost meanNGpostada meanNGpreada if n_u==1, robusteststo, title("Votes in 2019 (log)"): reg log_votesPost meanNGpostada meanNGpreada log_votesPre if n_u==1, robusteststo, title("Votes in 2019 (log)"): reg log_votesPost mean_negCamp_diff log_votesPre if n_u==1, robusteststo, title("Votes in 2015 (log)"): reg log_votesPre meanNGpostada meanNGpreada  if n_u==1, robusteststo, title("Votes in 2015 (log)"): reg log_votesPre mean_negCamp_diff  if n_u==1, robustesttab using "${PathTab}TableA25.tex", b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) keep(meanNGpostada meanNGpreada mean_negCamp_diff log_votesPre) order(meanNGpostada meanNGpreada mean_negCamp_diff log_votesPre) stats(N, fmt(0) labels("N")) label nodepvar mtitles title("Negative campaiging and electoral outcomes") replace nonotes postfoot(" ")**** Figure 6 ****set scheme plotplainblindreg log_votesPost meanNGpostada meanNGpreada log_votesPre if n_u==1, robustavplot meanNGpostada, mcolor(red) ytitle(Votes in 2019 (log)) scale(1.3) xtitle(Share of negative-campaigning tweets {bf:post} assasination) graphregion(color(white))graph export "${PathFig}Figure6a.png", width(3600) as(png) replacereg log_votesPost meanNGpostada meanNGpreada log_votesPre if n_u==1, robustavplot meanNGpreada, mcolor(red*0.5) ytitle(Votes in 2019 (log)) scale(1.3) xtitle(Share of negative-campaigning tweets {bf:pre} assasination) graphregion(color(white))graph export "${PathFig}Figure6b.png", width(3600) as(png) replacereg log_votesPost mean_negCamp_diff log_votesPre if n_u==1, robustavplot mean_negCamp_diff, mcolor(red*0.5) ytitle(Votes in 2019 (log)) scale(1.3) aspectratio(0.9) xtitle(Share negative-campaigning (difference post - pre assasination)) graphregion(color(white))graph export "${PathFig}Figure6c.png", width(3600) as(png) replace